<!DOCTYPE html>
<html lang="zh">
  <head>
    <title>
        Hugo搭建博客及编辑theme的方法 - GraphyHao&#39;s Blog
      </title>
        <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
      content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    
    <meta name="theme-color" content="#000000" />
    
    <meta http-equiv="window-target" content="_top" />
    
    
    <meta name="description" content="首先安装Hugo，本体只有hugo.exe及LICENSE文件 在cmd中运行hugo.exe，键入hugo new site XXXX(你的博客名) 可以看到" />
    <meta name="generator" content="Hugo 0.75.1 with theme pure" />
    <title>Hugo搭建博客及编辑theme的方法 - GraphyHao&#39;s Blog</title>
    
    
    <link rel="stylesheet" href="https://graphyhao.gitee.io/css/style.min.154c4cb4eedc210cfb116dc53b5438862a3a5519e854789ff967126ae88c565c.css">
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/9.15.10/styles/github.min.css" async>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css" async>
    <meta property="og:title" content="Hugo搭建博客及编辑theme的方法" />
<meta property="og:description" content="首先安装Hugo，本体只有hugo.exe及LICENSE文件 在cmd中运行hugo.exe，键入hugo new site XXXX(你的博客名) 可以看到" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://graphyhao.gitee.io/2020/09/cp2.html" />
<meta property="article:published_time" content="2020-09-18T23:55:04+08:00" />
<meta property="article:modified_time" content="2020-09-18T23:55:04+08:00" />
<meta itemprop="name" content="Hugo搭建博客及编辑theme的方法">
<meta itemprop="description" content="首先安装Hugo，本体只有hugo.exe及LICENSE文件 在cmd中运行hugo.exe，键入hugo new site XXXX(你的博客名) 可以看到">
<meta itemprop="datePublished" content="2020-09-18T23:55:04+08:00" />
<meta itemprop="dateModified" content="2020-09-18T23:55:04+08:00" />
<meta itemprop="wordCount" content="722">



<meta itemprop="keywords" content="web,Hugo," />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Hugo搭建博客及编辑theme的方法"/>
<meta name="twitter:description" content="首先安装Hugo，本体只有hugo.exe及LICENSE文件 在cmd中运行hugo.exe，键入hugo new site XXXX(你的博客名) 可以看到"/>

    <!--[if lte IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
      <![endif]-->

    <!--[if lt IE 9]>
        <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
      <![endif]-->
  </head>

  
  

  <body class="main-center theme-purple" itemscope itemtype="http://schema.org/WebPage"><header class="header" itemscope itemtype="http://schema.org/WPHeader">
    <div class="slimContent">
      <div class="navbar-header">
        <div class="profile-block text-center">
          <a id="avatar" href="https://graphyhao.gitee.io/" target="_blank">
            <img class="img-circle img-rotate" src="https://graphyhao.gitee.io/yun.jpeg" width="200" height="200">
          </a>
          <h2 id="name" class="hidden-xs hidden-sm">GraphyHao</h2>
          <h3 id="title" class="hidden-xs hidden-sm hidden-md">瓜皮浩的博客</h3>
          <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i>Guangzhou, China</small>
        </div><div class="search" id="search-form-wrap">
    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i
                        class="icon icon-search"></i></button>
            </span>
        </div>
        <div class="ins-search">
            <div class="ins-search-mask"></div>
            <div class="ins-search-container">
                <div class="ins-input-wrapper">
                    <input type="text" class="ins-search-input" placeholder="想要查找什么..."
                        x-webkit-speech />
                    <button type="button" class="close ins-close ins-selectable" data-dismiss="modal"
                        aria-label="Close"><span aria-hidden="true">×</span></button>
                </div>
                <div class="ins-section-wrapper">
                    <div class="ins-section-container"></div>
                </div>
            </div>
        </div>
    </form>
</div>
        <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
      </div>
      <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
        <ul class="nav navbar-nav main-nav">
            <li class="menu-item menu-item-home">
                <a href="/">
                    <i class="icon icon-home-fill"></i>
                  <span class="menu-title">首页</span>
                </a>
            </li>
            <li class="menu-item menu-item-archives">
                <a href="/posts/">
                    <i class="icon icon-archives-fill"></i>
                  <span class="menu-title">文章</span>
                </a>
            </li>
            <li class="menu-item menu-item-categories">
                <a href="/categories/">
                    <i class="icon icon-folder"></i>
                  <span class="menu-title">分类</span>
                </a>
            </li>
            <li class="menu-item menu-item-tags">
                <a href="/tags/">
                    <i class="icon icon-tags"></i>
                  <span class="menu-title">标签</span>
                </a>
            </li>
            <li class="menu-item menu-item-gallery">
                <a href="/gallery/">
                    <i class="icon icon-book-fill"></i>
                  <span class="menu-title">落书</span>
                </a>
            </li>
            <li class="menu-item menu-item-about">
                <a href="/about/">
                    <i class="icon icon-cup-fill"></i>
                  <span class="menu-title">关于</span>
                </a>
            </li>
        </ul>
      </nav>
    </div>
  </header>

<aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title">公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content"><p>博客更新theme了爽爽爽爽爽爽爽爽爽爽爽爽爽爽爽爽爽爽爽</p>
            </div>
        </div>
    </div>
</div>

      <div class="widget">
    <h3 class="widget-title"> 分类</h3>
    <div class="widget-body">
        <ul class="category-list">
            <li class="category-list-item"><a href="https://graphyhao.gitee.io/categories/%E8%BD%AF%E5%B7%A5%E5%AE%9E%E8%AE%AD.html" class="category-list-link">软工实训</a><span class="category-list-count">1</span></li>
            <li class="category-list-item"><a href="https://graphyhao.gitee.io/categories/%E8%BD%AF%E5%B7%A5%E5%AF%BC%E8%AE%BA.html" class="category-list-link">软工导论</a><span class="category-list-count">5</span></li>
        </ul>
    </div>
</div>
      <div class="widget">
    <h3 class="widget-title"> 标签</h3>
    <div class="widget-body">
        <ul class="tag-list">
            
            
            <li class="tag-list-item"><a href="https://graphyhao.gitee.io/tags/hugo.html" class="tag-list-link">hugo</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://graphyhao.gitee.io/tags/test.html" class="tag-list-link">test</a><span
                    class="tag-list-count">3</span></li>
            
            
            <li class="tag-list-item"><a href="https://graphyhao.gitee.io/tags/web.html" class="tag-list-link">web</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://graphyhao.gitee.io/tags/%E5%81%9A%E6%B8%B8%E6%88%8F.html" class="tag-list-link">做游戏</a><span
                    class="tag-list-count">1</span></li>
            
            
            <li class="tag-list-item"><a href="https://graphyhao.gitee.io/tags/%E8%BD%AF%E5%B7%A5%E5%AF%BC%E8%AE%BA.html" class="tag-list-link">软工导论</a><span
                    class="tag-list-count">6</span></li>
            
        </ul>

    </div>
</div>
      
<div class="widget">
    <h3 class="widget-title">最新文章</h3>
    <div class="widget-body">
        <ul class="recent-post-list list-unstyled no-thumbnail">
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://graphyhao.gitee.io/2020/10/h5.html" class="title">软工导论_作业五</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-10-07 18:00:04 &#43;0800 CST" itemprop="datePublished">2020-10-07</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://graphyhao.gitee.io/2020/10/h4.html" class="title">软工导论_作业四</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-10-07 14:00:04 &#43;0800 CST" itemprop="datePublished">2020-10-07</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://graphyhao.gitee.io/2020/09/cp4.html" class="title">软工导论_小游戏——斯卡蒂大冒险</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-09-29 14:00:04 &#43;0800 CST" itemprop="datePublished">2020-09-29</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://graphyhao.gitee.io/2020/09/h3.html" class="title">软工导论_作业三</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-09-28 03:55:04 &#43;0800 CST" itemprop="datePublished">2020-09-28</time>
                    </p>
                </div>
            </li>
            <li>
                <div class="item-inner">
                    <p class="item-title">
                        <a href="https://graphyhao.gitee.io/2020/09/h2.html" class="title">软工导论_作业二</a>
                    </p>
                    <p class="item-date">
                        <time datetime="2020-09-28 02:55:04 &#43;0800 CST" itemprop="datePublished">2020-09-28</time>
                    </p>
                </div>
            </li>
        </ul>
    </div>
</div>
  </div>
</aside>

    
    
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <h4 class="toc-title">文章目录</h4>
    <nav id="toc" class="js-toc toc">

    </nav>
  </div>
</aside>
<main class="main" role="main"><div class="content">
  <article id="-" class="article article-type-" itemscope
    itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      <h1 itemprop="name">
  <a
    class="article-title"
    href="/2020/09/cp2.html"
    >Hugo搭建博客及编辑theme的方法</a
  >
</h1>

      <div class="article-meta">
        
<span class="article-date">
  <i class="icon icon-calendar-check"></i>&nbsp;
<a href="https://graphyhao.gitee.io/2020/09/cp2.html" class="article-date">
  <time datetime="2020-09-18 23:55:04 &#43;0800 CST" itemprop="datePublished">2020-09-18</time>
</a>
</span>
  
  <span class="article-tag">
    <i class="icon icon-tags"></i>&nbsp;
    <a class="article-tag-link" href="/tags/web/"> web </a>
    <a class="article-tag-link" href="/tags/hugo/"> Hugo </a>
  </span>

	<span class="article-read hidden-xs">
    	<i class="icon icon-eye-fill" aria-hidden="true"></i>
    	<span id="https://graphyhao.gitee.io/2020/09/cp2.html" class="leancloud_visitors"  data-flag-title="Hugo搭建博客及编辑theme的方法">0</span>
    </span>
        <span class="post-comment"><i class="icon icon-comment"></i>&nbsp;<a href="/2020/09/cp2.html#comments"
            class="article-comment-link">评论</a></span>
		<span class="post-wordcount hidden-xs" itemprop="wordCount">字数统计: 722字</span>
		<span class="post-readcount hidden-xs" itemprop="timeRequired">阅读时长: 2分 </span>
      </div>
    </div>
    
    
    <audio controls>
      <source src="/music/Mitch Murder - killer angels [mqms2].mp3" type="audio/mpeg">
      您的浏览器不支持 audio 元素。
    </audio>


    <div class="article-entry marked-body js-toc-content" itemprop="articleBody">
      <p>首先安装Hugo，本体只有hugo.exe及LICENSE文件</p>
<p>在cmd中运行hugo.exe，键入hugo new site XXXX(你的博客名)</p>
<p>可以看到已经生成了一个以你的博客名为名字的文件夹，cmd cd进入这个文件夹</p>
<p>将你的hugo.exe及LICENSE文件也同时复制进该目录</p>
<p>然后，进入 <a href="https://themes.gohugo.io/">Hugo主题网页</a>选择一个你喜欢的主题</p>
<p>在github上下载下来后，在你的网址文件夹建立一个themes文件夹，并把你的主题解压进去</p>
<p>同时可以看看themes内有没有examplesite文件夹，可以帮助你了解这个主题的运作方法，有的话可以直接把examplesite内的内容复制到网站文件夹中去。</p>
<h2 id="主要遇到的问题">主要遇到的问题：</h2>
<h3 id="gitee-页面搭建问题">gitee 页面搭建问题：</h3>
<p>你可以先用hugo server -D 在本地服务器上测试你的页面，但测试完后需要再打hugo指令创建一个静态页面（在public文件夹中），在上传git时，只需要上传public文件夹内的内容即可。（hugo的工作原理就是通过theme给你的）</p>
<p>然后使用gitee page服务，注意生成的域名，需要在config中更改</p>
<h3 id="生成网页后渲染丢失的问题">生成网页后，渲染丢失的问题：</h3>
<p>config文件中加上</p>
<pre><code>`relativeurls=true`

`uglyurls=true`
</code></pre>
<h2 id="修改别人的theme">修改别人的theme：</h2>
<p>hugo的theme的工作原理，是通过用“自己的内容”替换预先写好的html，生成一个新的静态页面。</p>
<p>因此更改样式只要直接在你要更改的样式对应theme中的那部分html即可。</p>
<p>本主题自己修改了国内不存在的twitter和Facebook，并改成了国内的平台。</p>
<h2 id="本博客还有许多可以改进的地方如">本博客还有许多可以改进的地方，如：</h2>
<p>1.增加tag选择页面</p>
<p>2.增加背景神必抖动动态效果</p>
<p>3.增加live2D小人（也许吧）</p>
<p>4.增加评论区（用livere试试）
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<!-- raw HTML omitted --></p>
<p>先这么多b <br>
一个更好的同学的Hugo搭建blog详细讲解：
<a href="https://blog.csdn.net/qq_45975757/article/details/108923612">https://blog.csdn.net/qq_45975757/article/details/108923612</a></p>

    </div>
    <div class="article-footer">
<blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接: </strong>
      <a href="https://graphyhao.gitee.io/2020/09/cp2.html" title="Hugo搭建博客及编辑theme的方法" target="_blank" rel="external">https://graphyhao.gitee.io/2020/09/cp2.html</a>
    </li>
    <li class="post-copyright-license">
      <strong>License：</strong><a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external">CC BY 4.0 CN</a>
    </li>
  </ul>
</blockquote>

<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://graphyhao.gitee.io/" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://graphyhao.gitee.io/yun.jpeg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://graphyhao.gitee.io/" target="_blank"><span class="text-dark">GraphyHao</span><small class="ml-1x">瓜皮浩的博客</small></a></h3>
        <div>我要吃憨八哥啊啊啊啊啊啊啊啊啊啊啊</div>
      </div>
    </figure>
  </div>
</div>
    </div>
  </article>
<section id="comments">
    <div id="vcomments"></div>
</section>

</div><nav class="bar bar-footer clearfix" data-stick-bottom>
    <div class="bar-inner">
        <ul class="pager pull-left">
            <li class="prev">
                <a href="https://graphyhao.gitee.io/2020/09/cp1.html" title="My first Chapter"><i
                        class="icon icon-angle-left"
                        aria-hidden="true"></i><span>&nbsp;&nbsp;下一篇</span></a>
            </li>
            <li class="next">
                <a href="https://graphyhao.gitee.io/2020/09/h1.html"
                    title="软工导论_作业一"><span>上一篇&nbsp;&nbsp;</span><i
                        class="icon icon-angle-right" aria-hidden="true"></i></a>
            </li>
            
            <li class="toggle-toc">
                <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false"
                    title="文章目录" role="button">
                    <span>[&nbsp;</span><span>文章目录</span>
                    <i class="text-collapsed icon icon-anchor"></i>
                    <i class="text-in icon icon-close"></i>
                    <span>]</span>
                </a>
            </li>
        </ul>
        <div class="bar-right">
            <div class="share-component" data-sites="weibo,qq,wechat,twitter"
                data-mobile-sites="weibo,wechat,qq,qzone"></div>
        </div>
    </div>
</nav>

</main><footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
<ul class="social-links">
    <li><a href="https://github.com/hatut" target="_blank" title="github" data-toggle=tooltip data-placement=top >
            <i class="icon icon-github"></i></a></li>
    <li><a href="https://twitter.com/NGrafield" target="_blank" title="twitter" data-toggle=tooltip data-placement=top >
            <i class="icon icon-twitter"></i></a></li>
    <li><a href="http://weibo.com/hatut" target="_blank" title="weibo" data-toggle=tooltip data-placement=top >
            <i class="icon icon-weibo"></i></a></li>
</ul>
  <div class="copyright">
    &copy;2019  -
    2020
    <div class="publishby">
        Theme base on <a href="https://github.com/xiaoheiAh" target="_blank"> xiaoheiAh </a> 's <a href="https://github.com/xiaoheiAh/hugo-theme-pure" target="_blank"> pure</a>.
    </div>
  </div>
</footer>

<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_SVG"></script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
            showMathMenu: false, //disables context menu
            tex2jax: {
            inlineMath: [ ['$','$'], ['\\(','\\)'] ]
           }
    });
</script>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
<script>
    window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/highlight.min.js"></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/python.min.js" defer></script>
<script type="text/javascript" src="https://cdn.staticfile.org/highlight.js/9.15.10/languages/javascript.min.js" defer></script><script>
    hljs.configure({
        tabReplace: '    ', 
        classPrefix: ''     
        
    })
    hljs.initHighlightingOnLoad();
</script>
<script src="https://graphyhao.gitee.io/js/application.min.bdeb64b910570b6c41badc6a05b7afb0c8ad9efd8525de3c7257d59e786326a3.js"></script>
<script src="https://graphyhao.gitee.io/js/plugin.min.51ff8c7317566f82259170fa36e09c4493adc9b9378b427a01ad3f017ebac7dd.js"></script>

<script>
    (function (window) {
        var INSIGHT_CONFIG = {
            TRANSLATION: {
                POSTS: '文章',
                PAGES: '页面',
                CATEGORIES: '分类',
                TAGS: '标签',
                UNTITLED: '(未命名)',
            },
            ROOT_URL: 'https:\/\/graphyhao.gitee.io\/',
            CONTENT_URL: 'https:\/\/graphyhao.gitee.io\/\/searchindex.json ',
        };
        window.INSIGHT_CONFIG = INSIGHT_CONFIG;
    })(window);
</script>
<script type="text/javascript" src="https://graphyhao.gitee.io/js/insight.min.a343cd9a5a7698336b28ef3a7c16a3a1b1d2d5fb17dc8ed04022bbe08cc5459073a15bdafa3a8a58cdd56080784bdd69fa70b1ae8597565c799c57ed00f0e120.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
<script>
    tocbot.init({
        
        tocSelector: '.js-toc',
        
        contentSelector: '.js-toc-content',
        
        headingSelector: 'h1, h2, h3',
        
        hasInnerContainers: true,
    });
</script>

<script src="https://cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine"></script>
<script type="text/javascript">
    var GUEST = ['nick', 'mail', 'link'];
    var meta = 'nick,mail';
    meta = meta.split(',').filter(function (item) {
        return GUEST.indexOf(item) > -1;
    });
    new Valine({
        el: '#vcomments',
        verify: null ,
        notify: true ,
        appId: '5344hnGlswDIeceT6KP94TcD-gzGzoHsz',
        appKey: 'uheypCj1LpGPTz0PQVb60YOS',
        placeholder: '发条友善的评论~',
        avatar: 'retro',
        meta: meta,
        pageSize: '10' || 10,
        visitor: true 
});
</script>

  </body>
</html>
